/*******************************************************************************
 * Copyright (c) 2007 University of Oslo.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     University of Oslo - initial API and implementation
 *******************************************************************************/

package com.cea.papyrus.diagram.sequence.sedi.editor;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.gef.requests.CreationFactory;
import org.eclipse.uml2.uml.MessageSort;
import org.eclipse.uml2.uml.UMLPackage;

/**
 * Creates specification objects for new links. The specification objects
 * contains information about exactly what kind of links are to be created 
 * and initial values for their properties.
 *
 * @author frankd@ifi.uio.no
 */
public class SeDiEditorLinkFactory implements CreationFactory {
	private final EClass linkClass;
	private final MessageSort messageSort;
	//private final String keyword;
	
	public SeDiEditorLinkFactory(final EClass linkClass) {
		this(linkClass, null);
	}
	
	public SeDiEditorLinkFactory(final EClass linkClass, final MessageSort messageSort) {
		//this(linkClass, messageSort, null);
		this.linkClass = linkClass;
		this.messageSort = messageSort;
	}
	/*public SeDiEditorLinkFactory(final EClass linkClass, final MessageSort messageSort, final String keyword) {
		this.linkClass = linkClass;
		this.messageSort = messageSort;
		this.keyword = keyword;
	}*/
	
	public Object getNewObject() {
		if (linkClass == UMLPackage.eINSTANCE.getMessage())
			return new MessageSpecification(messageSort /*, keyword */);
		else
			return new SeparatorSpecification();
	}

	public Object getObjectType() {
		return linkClass;
	}
}
